﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Lb4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            violetCostLabel.Text += new Violet().Cost;
            camomileCostLabel.Text += new Camomile().Cost;
        }

        private void calculateButton_Click(object sender, EventArgs e)
        {
            int roseAmount, violetAmount, camomileAmount;
            if (roseAmountTextBox.Text == "" || violetAmountTextBox.Text == "" || camomileAmountTextBox.Text == "")
            {
                MessageBox.Show("Введите количество цветов в каждое из окон", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                roseAmount = Convert.ToInt32(roseAmountTextBox.Text);
                violetAmount = Convert.ToInt32(violetAmountTextBox.Text);
                camomileAmount = Convert.ToInt32(camomileAmountTextBox.Text);

                checkLabel.Text = "";
                CostCalculator costCalc = new CostCalculator();
                int totalCost = costCalc.GetTotalCost(roseAmount, violetAmount, camomileAmount);
                totalCostLabel.Text = totalCost.ToString();

                System.IO.File.WriteAllText("LogFile.txt", roseLabel.Text + "\r\n" + amountLabel.Text + roseAmountTextBox.Text + "\r\n"
                    + roseCostLabel.Text + "\r\n" + violetLabel.Text + "\r\n" + amountLabel.Text + violetAmountTextBox.Text + "\r\n" +
                    violetCostLabel.Text + "\r\n" + camomileLabel.Text + "\r\n" + amountLabel.Text + camomileAmountTextBox.Text + "\r\n" 
                    + camomileCostLabel.Text + "\r\n" + costLabel.Text + totalCostLabel.Text);
            }
        }
    }
}
